﻿using SC2BuildPlannerLib.Enums;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SC2BuildPlannerLib.Upgrades
{
    /// <summary>
    /// Class containing all upgrade data
    /// </summary>
    public class Upgrade
    {
        /// <summary>
        /// Property for the upgrade type
        /// </summary>
        private UpgradeEnum _upgradeType;
        public UpgradeEnum UpgradeType
        {
            get { return _upgradeType; }
            set { _upgradeType = value; }
        }

        /// <summary>
        /// Property for the status of an upgrade
        /// </summary>
        private UpgradeStatus _status;
        public UpgradeStatus Status
        {
            get { return _status; }
            set { _status = value; }
        }

        /// <summary>
        /// Property for the mineral cost of the upgrade
        /// </summary>
        private int _mineralCost;
        public int MineralCost
        {
            get { return _mineralCost; }
            set { _mineralCost = value; }
        }

        /// <summary>
        /// Property for the gas cost of the upgrade
        /// </summary>
        private int _gasCost;
        public int GasCost
        {
            get { return _gasCost; }
            set { _gasCost = value; }
        }

        /// <summary>
        /// Property for the time required to produce the upgrade
        /// </summary>
        private TimeSpan _timeCost;
        public TimeSpan TimeCost
        {
            get { return _timeCost; }
            set { _timeCost = value; }
        }

        /// <summary>
        /// Property for the structure/unit from which this upgrade is produced
        /// </summary>
        private ProductionEnum _producedFrom;
        public ProductionEnum ProducedFrom
        {
            get { return _producedFrom; }
            set { _producedFrom = value; }
        }

        /// <summary>
        /// Property for the structure required to produce the upgrade
        /// </summary>
        private BuildingEnum? _requiredBuilding;
        public BuildingEnum? RequiredBuilding
        {
            get { return _requiredBuilding; }
            set { _requiredBuilding = value; }
        }

        /// <summary>
        /// Property for the upgrade required to produce the upgrade
        /// </summary>
        private UpgradeEnum? _requiredUpgrade;
        public UpgradeEnum? RequiredUpgrade
        {
            get { return _requiredUpgrade; }
            set { _requiredUpgrade = value; }
        }

        public Upgrade(UpgradeEnum upgradeType, PatchExpansion patchExpansion)
        {
            UpgradeType = upgradeType;

            switch (upgradeType)
            {
                case UpgradeEnum.CombatShield:
                    MineralCost = 100;
                    GasCost = 100;
                    TimeCost = TimeSpan.FromSeconds(110);
                    ProducedFrom = ProductionEnum.TechLabOnBarracks;
                    break;
                case UpgradeEnum.Stimpack:
                    MineralCost = 100;
                    GasCost = 100;
                    TimeCost = TimeSpan.FromSeconds(170);
                    ProducedFrom = ProductionEnum.TechLabOnBarracks;
                    break;
                case UpgradeEnum.ConcussiveShells:
                    MineralCost = 50;
                    GasCost = 50;
                    TimeCost = TimeSpan.FromSeconds(60);
                    ProducedFrom = ProductionEnum.TechLabOnBarracks;
                    break;
                case UpgradeEnum.NitroPacks:
                    MineralCost = 50;
                    GasCost = 50;
                    TimeCost = TimeSpan.FromSeconds(100);
                    ProducedFrom = ProductionEnum.TechLabOnBarracks;
                    RequiredBuilding = BuildingEnum.Factory;
                    break;
                case UpgradeEnum.InfernalPreIgniter:
                    MineralCost = 150;
                    GasCost = 150;
                    TimeCost = TimeSpan.FromSeconds(110);
                    ProducedFrom = ProductionEnum.TechLabOnFactory;
                    break;
                case UpgradeEnum.SiegeTech:
                    MineralCost = 100;
                    GasCost = 100;
                    TimeCost = TimeSpan.FromSeconds(80);
                    ProducedFrom = ProductionEnum.TechLabOnFactory;
                    break;
                case UpgradeEnum.StrikeCannon:
                    MineralCost = 150;
                    GasCost = 150;
                    TimeCost = TimeSpan.FromSeconds(110);
                    ProducedFrom = ProductionEnum.TechLabOnFactory;
                    break;
                case UpgradeEnum.CaduceusReactor:
                    MineralCost = 100;
                    GasCost = 100;
                    TimeCost = TimeSpan.FromSeconds(80);
                    ProducedFrom = ProductionEnum.TechLabOnStarport;
                    break;
                case UpgradeEnum.CorvidReactor:
                    MineralCost = 150;
                    GasCost = 150;
                    TimeCost = TimeSpan.FromSeconds(110);
                    ProducedFrom = ProductionEnum.TechLabOnStarport;
                    break;
                case UpgradeEnum.DurableMaterials:
                    MineralCost = 150;
                    GasCost = 150;
                    TimeCost = TimeSpan.FromSeconds(110);
                    ProducedFrom = ProductionEnum.TechLabOnStarport;
                    break;
                case UpgradeEnum.CloakingField:
                    MineralCost = patchExpansion == PatchExpansion.WingsOfLiberty ? 200 : 100;
                    GasCost = patchExpansion == PatchExpansion.WingsOfLiberty ? 200 : 100;
                    TimeCost = TimeSpan.FromSeconds(110);
                    ProducedFrom = ProductionEnum.TechLabOnStarport;
                    break;
                case UpgradeEnum.InfantryWeapons1:
                    MineralCost = 100;
                    GasCost = 100;
                    TimeCost = TimeSpan.FromSeconds(160);
                    ProducedFrom = ProductionEnum.EngineeringBay;
                    break;
                case UpgradeEnum.InfantryWeapons2:
                    MineralCost = 175;
                    GasCost = 175;
                    TimeCost = TimeSpan.FromSeconds(190);
                    ProducedFrom = ProductionEnum.EngineeringBay;
                    RequiredBuilding = BuildingEnum.Armory;
                    RequiredUpgrade = UpgradeEnum.InfantryWeapons1;
                    break;
                case UpgradeEnum.InfantryWeapons3:
                    MineralCost = 250;
                    GasCost = 250;
                    TimeCost = TimeSpan.FromSeconds(220);
                    ProducedFrom = ProductionEnum.EngineeringBay;
                    RequiredBuilding = BuildingEnum.Armory;
                    RequiredUpgrade = UpgradeEnum.InfantryWeapons2;
                    break;
                case UpgradeEnum.HiSecAutoTracking:
                    MineralCost = 100;
                    GasCost = 100;
                    TimeCost = TimeSpan.FromSeconds(80);
                    ProducedFrom = ProductionEnum.EngineeringBay;
                    break;
                case UpgradeEnum.BuildingArmor:
                    MineralCost = 150;
                    GasCost = 150;
                    TimeCost = TimeSpan.FromSeconds(140);
                    ProducedFrom = ProductionEnum.EngineeringBay;
                    break;
                case UpgradeEnum.NeosteelFrame:
                    MineralCost = 100;
                    GasCost = 100;
                    TimeCost = TimeSpan.FromSeconds(110);
                    ProducedFrom = ProductionEnum.EngineeringBay;
                    break;
                case UpgradeEnum.MoebiusReactor:
                    MineralCost = 100;
                    GasCost = 100;
                    TimeCost = TimeSpan.FromSeconds(80);
                    ProducedFrom = ProductionEnum.GhostAcademy;
                    break;
                case UpgradeEnum.PersonalCloaking:
                    MineralCost = 150;
                    GasCost = 150;
                    TimeCost = TimeSpan.FromSeconds(120);
                    ProducedFrom = ProductionEnum.GhostAcademy;
                    break;
                case UpgradeEnum.VehicleWeapons1:
                    MineralCost = 100;
                    GasCost = 100;
                    TimeCost = TimeSpan.FromSeconds(160);
                    ProducedFrom = ProductionEnum.Armory;
                    break;
                case UpgradeEnum.VehicleWeapons2:
                    MineralCost = 175;
                    GasCost = 175;
                    TimeCost = TimeSpan.FromSeconds(190);
                    ProducedFrom = ProductionEnum.Armory;
                    RequiredUpgrade = UpgradeEnum.VehicleWeapons1;
                    break;
                case UpgradeEnum.VehicleWeapons3:
                    MineralCost = 250;
                    GasCost = 250;
                    TimeCost = TimeSpan.FromSeconds(220);
                    ProducedFrom = ProductionEnum.Armory;
                    RequiredUpgrade = UpgradeEnum.VehicleWeapons2;
                    break;
                case UpgradeEnum.ShipWeapons1:
                    MineralCost = 100;
                    GasCost = 100;
                    TimeCost = TimeSpan.FromSeconds(160);
                    ProducedFrom = ProductionEnum.Armory;
                    break;
                case UpgradeEnum.ShipWeapons2:
                    MineralCost = 175;
                    GasCost = 175;
                    TimeCost = TimeSpan.FromSeconds(190);
                    ProducedFrom = ProductionEnum.Armory;
                    RequiredUpgrade = UpgradeEnum.ShipWeapons1;
                    break;
                case UpgradeEnum.ShipWeapons3:
                    MineralCost = 250;
                    GasCost = 250;
                    TimeCost = TimeSpan.FromSeconds(220);
                    ProducedFrom = ProductionEnum.Armory;
                    RequiredUpgrade = UpgradeEnum.ShipWeapons2;
                    break;
                case UpgradeEnum.VehicleShipWeapons1:
                    MineralCost = 100;
                    GasCost = 100;
                    TimeCost = TimeSpan.FromSeconds(160);
                    ProducedFrom = ProductionEnum.Armory;
                    break;
                case UpgradeEnum.VehicleShipWeapons2:
                    MineralCost = 175;
                    GasCost = 175;
                    TimeCost = TimeSpan.FromSeconds(190);
                    ProducedFrom = ProductionEnum.Armory;
                    RequiredUpgrade = UpgradeEnum.VehicleShipWeapons1;
                    break;
                case UpgradeEnum.VehicleShipWeapons3:
                    MineralCost = 250;
                    GasCost = 250;
                    TimeCost = TimeSpan.FromSeconds(220);
                    ProducedFrom = ProductionEnum.Armory;
                    RequiredUpgrade = UpgradeEnum.VehicleShipWeapons2;
                    break;
                case UpgradeEnum.VehiclePlating1:
                    MineralCost = 100;
                    GasCost = 100;
                    TimeCost = TimeSpan.FromSeconds(160);
                    ProducedFrom = ProductionEnum.Armory;
                    break;
                case UpgradeEnum.VehiclePlating2:
                    MineralCost = 175;
                    GasCost = 175;
                    TimeCost = TimeSpan.FromSeconds(190);
                    ProducedFrom = ProductionEnum.Armory;
                    RequiredUpgrade = UpgradeEnum.VehiclePlating1;
                    break;
                case UpgradeEnum.VehiclePlating3:
                    MineralCost = 250;
                    GasCost = 250;
                    TimeCost = TimeSpan.FromSeconds(220);
                    ProducedFrom = ProductionEnum.Armory;
                    RequiredUpgrade = UpgradeEnum.VehiclePlating2;
                    break;
                case UpgradeEnum.ShipPlating1:
                    MineralCost = 150;
                    GasCost = 150;
                    TimeCost = TimeSpan.FromSeconds(160);
                    ProducedFrom = ProductionEnum.Armory;
                    break;
                case UpgradeEnum.ShipPlating2:
                    MineralCost = 225;
                    GasCost = 225;
                    TimeCost = TimeSpan.FromSeconds(190);
                    ProducedFrom = ProductionEnum.Armory;
                    RequiredUpgrade = UpgradeEnum.ShipPlating1;
                    break;
                case UpgradeEnum.ShipPlating3:
                    MineralCost = 300;
                    GasCost = 300;
                    TimeCost = TimeSpan.FromSeconds(220);
                    ProducedFrom = ProductionEnum.Armory;
                    RequiredUpgrade = UpgradeEnum.ShipPlating2;
                    break;
                case UpgradeEnum.VehicleShipPlating1:
                    MineralCost = 100;
                    GasCost = 100;
                    TimeCost = TimeSpan.FromSeconds(160);
                    ProducedFrom = ProductionEnum.Armory;
                    break;
                case UpgradeEnum.VehicleShipPlating2:
                    MineralCost = 175;
                    GasCost = 175;
                    TimeCost = TimeSpan.FromSeconds(190);
                    ProducedFrom = ProductionEnum.Armory;
                    RequiredUpgrade = UpgradeEnum.VehicleShipPlating1;
                    break;
                case UpgradeEnum.VehicleShipPlating3:
                    MineralCost = 250;
                    GasCost = 250;
                    TimeCost = TimeSpan.FromSeconds(220);
                    ProducedFrom = ProductionEnum.Armory;
                    RequiredUpgrade = UpgradeEnum.VehicleShipPlating2;
                    break;
                case UpgradeEnum.BehemothReactor:
                    MineralCost = 150;
                    GasCost = 150;
                    TimeCost = TimeSpan.FromSeconds(80);
                    ProducedFrom = ProductionEnum.FusionCore;
                    break;
                case UpgradeEnum.WeaponRefit:
                    MineralCost = 150;
                    GasCost = 150;
                    TimeCost = TimeSpan.FromSeconds(60);
                    ProducedFrom = ProductionEnum.FusionCore;
                    break;
                case UpgradeEnum.Burrow:
                    MineralCost = 100;
                    GasCost = 100;
                    TimeCost = TimeSpan.FromSeconds(100);
                    ProducedFrom = ProductionEnum.Hatchery;
                    break;
                case UpgradeEnum.PneumatizedCarapace:
                    MineralCost = 100;
                    GasCost = 100;
                    TimeCost = TimeSpan.FromSeconds(60);
                    ProducedFrom = ProductionEnum.Hatchery;
                    break;
                case UpgradeEnum.VentralSacs:
                    MineralCost = 200;
                    GasCost = 200;
                    TimeCost = TimeSpan.FromSeconds(130);
                    ProducedFrom = ProductionEnum.Hatchery;
                    RequiredBuilding = BuildingEnum.Lair;
                    break;
                case UpgradeEnum.MetabolicBoost:
                    MineralCost = 100;
                    GasCost = 100;
                    TimeCost = TimeSpan.FromSeconds(110);
                    ProducedFrom = ProductionEnum.SpawningPool;
                    break;
                case UpgradeEnum.AdrenalGlands:
                    MineralCost = 200;
                    GasCost = 200;
                    TimeCost = TimeSpan.FromSeconds(130);
                    ProducedFrom = ProductionEnum.SpawningPool;
                    RequiredBuilding = BuildingEnum.Hive;
                    break;
                case UpgradeEnum.MeleeAttacks1:
                    MineralCost = 100;
                    GasCost = 100;
                    TimeCost = TimeSpan.FromSeconds(160);
                    ProducedFrom = ProductionEnum.EvolutionChamber;
                    break;
                case UpgradeEnum.MeleeAttacks2:
                    MineralCost = 150;
                    GasCost = 150;
                    TimeCost = TimeSpan.FromSeconds(190);
                    ProducedFrom = ProductionEnum.EvolutionChamber;
                    RequiredBuilding = BuildingEnum.Lair;
                    RequiredUpgrade = UpgradeEnum.MeleeAttacks1;
                    break;
                case UpgradeEnum.MeleeAttacks3:
                    MineralCost = 200;
                    GasCost = 200;
                    TimeCost = TimeSpan.FromSeconds(220);
                    ProducedFrom = ProductionEnum.EvolutionChamber;
                    RequiredBuilding = BuildingEnum.Hive;
                    RequiredUpgrade = UpgradeEnum.MeleeAttacks2;
                    break;
                case UpgradeEnum.MissileAttacks1:
                    MineralCost = 100;
                    GasCost = 100;
                    TimeCost = TimeSpan.FromSeconds(160);
                    ProducedFrom = ProductionEnum.EvolutionChamber;
                    break;
                case UpgradeEnum.MissileAttacks2:
                    MineralCost = 150;
                    GasCost = 150;
                    TimeCost = TimeSpan.FromSeconds(190);
                    ProducedFrom = ProductionEnum.EvolutionChamber;
                    RequiredBuilding = BuildingEnum.Lair;
                    RequiredUpgrade = UpgradeEnum.MissileAttacks1;
                    break;
                case UpgradeEnum.MissileAttacks3:
                    MineralCost = 200;
                    GasCost = 200;
                    TimeCost = TimeSpan.FromSeconds(220);
                    ProducedFrom = ProductionEnum.EvolutionChamber;
                    RequiredBuilding = BuildingEnum.Hive;
                    RequiredUpgrade = UpgradeEnum.MissileAttacks2;
                    break;
                case UpgradeEnum.GroundCarapace1:
                    MineralCost = 150;
                    GasCost = 150;
                    TimeCost = TimeSpan.FromSeconds(160);
                    ProducedFrom = ProductionEnum.EvolutionChamber;
                    break;
                case UpgradeEnum.GroundCarapace2:
                    MineralCost = 225;
                    GasCost = 225;
                    TimeCost = TimeSpan.FromSeconds(190);
                    ProducedFrom = ProductionEnum.EvolutionChamber;
                    RequiredBuilding = BuildingEnum.Lair;
                    RequiredUpgrade = UpgradeEnum.GroundCarapace1;
                    break;
                case UpgradeEnum.GroundCarapace3:
                    MineralCost = 300;
                    GasCost = 300;
                    TimeCost = TimeSpan.FromSeconds(220);
                    ProducedFrom = ProductionEnum.EvolutionChamber;
                    RequiredBuilding = BuildingEnum.Hive;
                    RequiredUpgrade = UpgradeEnum.GroundCarapace2;
                    break;
                case UpgradeEnum.GlialReconstitution:
                    MineralCost = 100;
                    GasCost = 100;
                    TimeCost = TimeSpan.FromSeconds(110);
                    ProducedFrom = ProductionEnum.RoachWarren;
                    RequiredBuilding = BuildingEnum.Lair;
                    break;
                case UpgradeEnum.TunnelingClaws:
                    MineralCost = 150;
                    GasCost = 150;
                    TimeCost = TimeSpan.FromSeconds(110);
                    ProducedFrom = ProductionEnum.RoachWarren;
                    RequiredBuilding = BuildingEnum.Lair;
                    break;
                case UpgradeEnum.CentrifugalHooks:
                    MineralCost = 150;
                    GasCost = 150;
                    TimeCost = TimeSpan.FromSeconds(110);
                    ProducedFrom = ProductionEnum.BanelingNest;
                    RequiredBuilding = BuildingEnum.Lair;
                    break;
                case UpgradeEnum.GroovedSpines:
                    MineralCost = 150;
                    GasCost = 150;
                    TimeCost = TimeSpan.FromSeconds(80);
                    ProducedFrom = ProductionEnum.HydraliskDen;
                    break;
                case UpgradeEnum.MuscularAugments:
                    MineralCost = 150;
                    GasCost = 150;
                    TimeCost = TimeSpan.FromSeconds(100);
                    ProducedFrom = ProductionEnum.HydraliskDen;
                    break;
                case UpgradeEnum.PathogenGlands:
                    MineralCost = 150;
                    GasCost = 150;
                    TimeCost = TimeSpan.FromSeconds(80);
                    ProducedFrom = ProductionEnum.InfestationPit;
                    break;
                case UpgradeEnum.NeuralParasite:
                    MineralCost = 150;
                    GasCost = 150;
                    TimeCost = TimeSpan.FromSeconds(110);
                    ProducedFrom = ProductionEnum.InfestationPit;
                    break;
                case UpgradeEnum.EnduringLocusts:
                    MineralCost = 200;
                    GasCost = 200;
                    TimeCost = TimeSpan.FromSeconds(120);
                    ProducedFrom = ProductionEnum.InfestationPit;
                    break;
                case UpgradeEnum.FlyerAttacks1:
                    MineralCost = 100;
                    GasCost = 100;
                    TimeCost = TimeSpan.FromSeconds(160);
                    ProducedFrom = ProductionEnum.Spire;
                    break;
                case UpgradeEnum.FlyerAttacks2:
                    MineralCost = 175;
                    GasCost = 175;
                    TimeCost = TimeSpan.FromSeconds(190);
                    ProducedFrom = ProductionEnum.Spire;
                    RequiredBuilding = BuildingEnum.Lair;
                    RequiredUpgrade = UpgradeEnum.FlyerAttacks1;
                    break;
                case UpgradeEnum.FlyerAttacks3:
                    MineralCost = 250;
                    GasCost = 250;
                    TimeCost = TimeSpan.FromSeconds(220);
                    ProducedFrom = ProductionEnum.Spire;
                    RequiredBuilding = BuildingEnum.Hive;
                    RequiredUpgrade = UpgradeEnum.FlyerAttacks2;
                    break;
                case UpgradeEnum.FlyerCarapace1:
                    MineralCost = 100;
                    GasCost = 100;
                    TimeCost = TimeSpan.FromSeconds(160);
                    ProducedFrom = ProductionEnum.Spire;
                    break;
                case UpgradeEnum.FlyerCarapace2:
                    MineralCost = 175;
                    GasCost = 175;
                    TimeCost = TimeSpan.FromSeconds(190);
                    ProducedFrom = ProductionEnum.Spire;
                    RequiredBuilding = BuildingEnum.Lair;
                    RequiredUpgrade = UpgradeEnum.FlyerCarapace1;
                    break;
                case UpgradeEnum.FlyerCarapace3:
                    MineralCost = 250;
                    GasCost = 250;
                    TimeCost = TimeSpan.FromSeconds(220);
                    ProducedFrom = ProductionEnum.Spire;
                    RequiredBuilding = BuildingEnum.Hive;
                    RequiredUpgrade = UpgradeEnum.FlyerCarapace2;
                    break;
                case UpgradeEnum.ChitinousPlating:
                    MineralCost = 150;
                    GasCost = 150;
                    TimeCost = TimeSpan.FromSeconds(110);
                    ProducedFrom = ProductionEnum.UltraliskCavern;
                    break;
            }
        }
    }
}
